<template>
  <div>
    <Ball v-if="flag"></Ball>
    <button @click="switchBall">销毁</button>
  </div>
</template>

<script lang='ts'>
import {ref,reactive} from 'vue'
import Ball from './components/Ball.vue'
export default{
 components:{Ball},
 setup(){
  let flag=ref<Boolean>(true)
  const switchBall:()=>void=()=>{
    flag.value=!flag.value
  }
  return{
    flag,
    switchBall
  }
 }
}
</script>

<style lang='scss' scoped>
</style>